﻿using System;

namespace Database.Core.Attributes
{
  /// <summary>
  /// Provides child object property/column mapping from the parent datatable. However, child attributes
  /// (such as ColumnName) are ignored when creating the child item.
  /// </summary>
  [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
  public class ChildColumnMap : ColumnName
  {
    /// <summary>
    /// Gets the name of the child property.
    /// </summary>
    /// <value>The name of the child property.</value>
    public string ChildPropertyName { get; private set; }

    /// <summary>
    /// Initializes a new instance of the <see cref="ChildColumnMap"/> class.
    /// </summary>
    /// <param name="columnName">Name of the data column.</param>
    /// <param name="childPropertyName">Name of the child property.</param>
    public ChildColumnMap(string columnName, string childPropertyName)
      : base(columnName)
    {
      ChildPropertyName = childPropertyName;
    }
  }
}
